% this program requires installation of BayesX
% http://www.stat.uni-muenchen.de/~bayesx/bayesx.html

% usefile votes_bycongress_spatial.prg

   dataset rc

   rc.infile, maxobs=8000 using C:\rollcall.logit.inter.all.names.txt

   rc.generate district = t*10 + region

   map rcmap

   rcmap.infile using C:\rollcall.mapfile.txt

   bayesreg b

   b.outfile = spatial

   logopen, replace using logmcmc.txt

   b.regress prolabor = district(spatial, map=rcmap) + unionpop*district(spatial, map=rcmap) + dem + laborcomm + urbanpct*district(spatial, map=rcmap) + aapct*district(spatial, map=rcmap), family=binomialprobit iterations=100000 burnin=10000 step=10 predict using rc

   b.getsample

   b.autocorr, maxlag=100

   logclose
   
